ListNode* mergeInBetween(ListNode* list1, int a, int b, ListNode* list2) {
        ListNode *pa = list1;
        for(int i = 0; i < a - 1; ++i)
            pa = pa->next;

        ListNode *pb = pa->next;
        for(int i = a; i <= b; ++i)
            pb = pb->next;

        pa->next = list2;

        while(list2->next)
            list2 = list2->next;
        list2->next = pb;
        return list1;
    }